import { ModuleWithProviders } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';


import { LoginComponent } from '../pages/login/login.component';

// Components
import { AppComponent } from './app.component';
import {CanActivateGuard} from '../pages/services/can-activate-guard.service';
import {LayoutAuthComponent} from '../pages/layouts/auth/auth';    //文件名符合首字母大写+文件类型
import {AppHeaderComponent} from '../pages/widgets/app-header/app-header.component';

const routes: Routes = [
  // not logged routes
  {
    canActivate: [CanActivateGuard],
    children: [
      {
        canActivate: [CanActivateGuard],
        loadChildren: '../pages/board/home/home.module#HomeModule',
        path: ''
      },
      {
        canActivate: [CanActivateGuard],
        loadChildren: '../pages/board/home/home.module#HomeModule',
        path: 'home'
      },
    ],
    component: LayoutAuthComponent,
    data: [{
      'skin': 'skin-black',
      'display_tasks': false,
      'header_components': [{
        class: AppHeaderComponent,
        data: {
          label: 'test widget'
        }
      }]
    }],
    path: '',
  },
  {
    canActivate: [CanActivateGuard],
    children: [
      {
        canActivate: [CanActivateGuard],
        loadChildren: '../pages/board/page-num/page-num.module#PageNumModule',
        path: 'page/:id'
      }
    ],
    component: LayoutAuthComponent,
    data: [{
      'skin': 'skin-black',
      'boxed_style': false,
      'display_tasks': false,
      'header_components': [{
        class: AppHeaderComponent,
        data: {
          label: 'test widget'
        }
      }]
    }],
    path: '',
  },
  {
    path:'login',
    component:LoginComponent
  }
];

export const routing: ModuleWithProviders = RouterModule.forRoot(routes, { enableTracing: false });
